function varargout = Gui(varargin)
% GUI MATLAB code for Gui.fig
%      GUI, by itself, creates a new GUI or raises the existing
%      singleton*.
%
%      H = GUI returns the handle to a new GUI or the handle to
%      the existing singleton*.
%
%      GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GUI.M with the given input arguments.
%
%      GUI('Property','Value',...) creates a new GUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Gui_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Gui_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help Gui

% Last Modified by GUIDE v2.5 18-Mar-2014 16:53:56

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @Gui_OpeningFcn, ...
    'gui_OutputFcn',  @Gui_OutputFcn, ...
    'gui_LayoutFcn',  [] , ...
    'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before Gui is made visible.
function Gui_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to Gui (see VARARGIN)

% Choose default command line output for Gui
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Gui_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in exitButton.
function exitButton_Callback(hObject, eventdata, handles)
% hObject    handle to exitButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
clc
clear all
close(gcf);

% --- Executes on button press in loadButton.
function loadButton_Callback(hObject, eventdata, handles)
% hObject    handle to loadButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

[filename, pathname] = uigetfile({'*.xls';'*.xlsx'},'Choose a File','b.xlsx');

if isequal(filename,0)
    errodlg('Wrong File', 'File open Error');
    return
end

str=[pathname, filename];
% set(handles.edit4,'string',str);

% Read Excel LP data
global f;
f=xlsread(str, 'f');

h=waitbar(0, 'Please wait, reading the file now...');

ALEqual=xlsread(str, 'A(<=)');
bLEqual=xlsread(str, 'b(<=)');
AGEqual=xlsread(str, 'A(>=)');
bGEqual=xlsread(str, 'b(>=)');
Aeq=xlsread(str, 'Aeq');
beq=xlsread(str, 'beq');

% Get no. of constraints and variables
[ALEqualRow ALEqualCol]= size(ALEqual);                 % <=
[AGEqualRow AGEqualCol]= size(AGEqual);                 % >=
[AeqRow AeqCol]= size(Aeq);                             % =

constraint = ALEqualRow + AGEqualRow + AeqRow;        % m
variable = max(ALEqualCol,max(AGEqualCol,AeqCol));    % n

noIneqConstraint = ALEqualRow + AGEqualRow;

slackVar = noIneqConstraint + variable;        % slack variable

% Transform import LP to standard form Ax <= b, Bx = 0
% Add zeros for f, A, Aeq, b
global nF nAeq nbeq;
nF = f;
nALEqual = ALEqual;
nAGEqual = AGEqual;
nAeq = Aeq;
nbeq = beq;

% New beq - combine sum of inequality and equality constraints
nbeq = [beq;bLEqual];
nbeq = [nbeq;bGEqual];

% New f
nF(1,slackVar) = 0;
nF = nF';
if isempty(nAeq) == 0
    nAeq(AeqRow,slackVar)= 0;
end

if isempty(nALEqual) == 0
    nALEqual(ALEqualRow,slackVar)= 0;
    % new Aeq -add inequality constraints to new A
    nAeq=[nAeq;nALEqual];
end

if isempty(nAGEqual) == 0
    nAGEqual(AGEqualRow,slackVar)= 0;
    % add inequality constraints to new A
    nAeq=[nAeq;nAGEqual];
end

% index of A (constraints) row
if isempty(nAeq)
    rowOfAeq = 1;
else
    rowOfAeq = 1 + AeqRow;
end

% index of A (constraints) column (slack variable)
colOfAeq = constraint + 1;

% New Aeq - add slack variable for inequality constraints for
% changing to equality constraint
% (<= constraint)
if isempty(nALEqual) == 0
    for ii=rowOfAeq:1:AeqRow + ALEqualRow
        nAeq(rowOfAeq,colOfAeq) = 1;
        rowOfAeq = rowOfAeq + 1;
        colOfAeq = colOfAeq + 1;
    end
end
%(>= constraint)
if isempty(nAGEqual) == 0
    for ii=rowOfAeq:1:AeqRow + ALEqualRow + AGEqual
        nAeq(rowOfAeq,colOfAeq) = -1;
        rowOfAeq = rowOfAeq + 1;
        colOfAeq = colOfAeq + 1;
    end
end
% New b
nb = zeros(slackVar,1);


% assume the variables are not bounded
% New A - add inequality constraints for those constraints
rowOfA = 1;
colOfA = 1;
global nA;
nA=[];

% (=, <=, & >= constraint)
if isempty(nAeq) == 0
    for ii=rowOfA:1:variable
        nA(rowOfA,colOfA) = -1;    % aki 'NaN'
        rowOfA = rowOfA + 1;
        colOfA = colOfA + 1;
    end
end

% Added slack variable constraint
if isempty(nAeq) == 0
    for ii=rowOfA:1:slackVar
        nA(rowOfA,colOfA) = -1;
        rowOfA = rowOfA + 1;
        colOfA = colOfA + 1;
    end
end

global sF sA;

% disp f (objective)
n=0;
sF='';
firstV=true;
for ii=1:1:length(f)
    if (f(1,ii) == 0 )
        sF = sF;
        n=n+1;
    else if (f(1,ii) > 0 )
            n=n+1;
            if firstV == true
                if (f(1,ii) == 1)
                    sF = [sF 'x' num2str(n) '' ];
                else
                    sF = [sF num2str(f(1,ii)) 'x' num2str(n) '' ];
                end
                firstV=false;
            else
                if (f(1,ii) == 1)
                    sF = [sF ' + x' num2str(n) '' ];
                else
                    sF = [sF ' + ' num2str(f(1,ii)) 'x' num2str(n) '' ];
                end
            end
        else
            n=n+1;
            if firstV == true
                if (f(1,ii) == -1)
                    sF = [sF '- x' num2str(ii) '' ];
                else
                    sF = [sF num2str(f(1,ii)) 'x' num2str(ii) '' ];
                end
                firstV=false;
            else
                if (f(1,ii) == -1)
                    sF = [sF ' - x' num2str(n) '' ];
                else
                    sF = [sF ' - ' num2str(abs(f(1,ii))) 'x' num2str(n) '' ];
                end
            end
        end
    end
end

% display Ax <= b (inequality constraints)
n=0;
rowOfA=1;
tempA='';
firstV=true;
sA=[];
[row col]=size(ALEqual);
for ii=1:1:row
    for jj=1:1:col
        if (ALEqual(ii,jj) == 0 )
            n=n+1;
            tempA = tempA;
        else if (ALEqual(ii,jj) > 0 )
                n=n+1;
                if firstV == true
                    if (ALEqual(ii,jj) == 1)
                        tempA = [tempA 'x' num2str(n) '' ];
                    else
                        tempA = [tempA num2str(ALEqual(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (ALEqual(ii,jj) == 1)
                        tempA = [tempA ' + x' num2str(n) '' ];
                    else
                        tempA = [tempA ' + ' num2str(ALEqual(ii,jj)) 'x' num2str(n) '' ];
                    end
                end
            else
                n=n+1;
                if firstV == true
                    if (ALEqual(ii,jj) == -1)
                        tempA = [tempA '- x' num2str(n) '' ];
                    else
                        tempA = [tempA num2str(ALEqual(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (ALEqual(ii,jj) == -1)
                        tempA = [tempA ' - x' num2str(n) '' ];
                    else
                        tempA = [tempA ' - ' num2str(abs(ALEqual(ii,jj))) 'x' num2str(n) '' ];
                    end
                end
            end
        end
    end
    tempA = [tempA ' <= ' num2str(bLEqual(ii)) ];
    sA{rowOfA,1}=tempA;
    rowOfA = rowOfA + 1;
    n=0;
    tempA='';
    firstV=true;
end

% display Ax >= b (inequality constraints)
n=0;
tempA='';
firstV=true;
[row col]=size(AGEqual);
for ii=1:1:row
    for jj=1:1:col
        if (AGEqual(ii,jj) == 0 )
            n=n+1;
            tempA = tempA;
        else if (AGEqual(ii,jj) > 0 )
                n=n+1;
                if firstV == true
                    if (AGEqual(ii,jj) == 1)
                        tempA = [tempA 'x' num2str(n) '' ];
                    else
                        tempA = [tempA num2str(AGEqual(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (AGEqual(ii,jj) == 1)
                        tempA = [tempA ' + x' num2str(n) '' ];
                    else
                        tempA = [tempA ' + ' num2str(AGEqual(ii,jj)) 'x' num2str(n) '' ];
                    end
                end
            else
                n=n+1;
                if firstV == true
                    if (AGEqual(ii,jj) == -1)
                        tempA = [tempA ' - x' num2str(n) '' ];
                    else
                        tempA = [tempA num2str(AGEqual(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (AGEqual(ii,jj) == -1)
                        tempA = [tempA ' - x' num2str(n) '' ];
                    else
                        tempA = [tempA ' - ' num2str(abs(AGEqual(ii,jj))) 'x' num2str(n) '' ];
                    end
                end
            end
        end
    end
    tempA = [tempA ' >= ' num2str(bGEqual(ii)) ];
    sA{rowOfA,1}=tempA;
    rowOfA = rowOfA + 1;
    n=0;
    tempA='';
    firstV=true;
end

% display Aeqx = beq (equality constraints)
n=0;
tempAeq='';
firstV=true;
[row col]=size(Aeq);
for ii=1:1:row
    for jj=1:1:col
        if (Aeq(ii,jj) == 0 )
            n=n+1;
            tempAeq = tempAeq;
        else if (Aeq(ii,jj) > 0 )
                n=n+1;
                if firstV == true
                    if (Aeq(ii,jj) == 1)
                        tempAeq = [tempAeq 'x' num2str(n) '' ];
                    else
                        tempAeq = [tempAeq num2str(Aeq(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (Aeq(ii,jj) == 1)
                        tempAeq = [tempAeq ' + x' num2str(n) '' ];
                    else
                        tempAeq = [tempAeq ' + ' num2str(Aeq(ii,jj)) 'x' num2str(n) '' ];
                    end
                end
            else
                n=n+1;
                if firstV == true
                    if (Aeq(ii,jj) == -1)
                        tempAeq = [tempAeq ' - x' num2str(n) '' ];
                    else
                        tempAeq = [tempAeq num2str(Aeq(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (Aeq(ii,jj) == -1)
                        tempAeq = [tempAeq ' - x' num2str(n) '' ];
                    else
                        tempAeq = [tempAeq ' - ' num2str(abs(Aeq(ii,jj))) 'x' num2str(n) '' ];
                    end
                end
            end
        end
    end
    tempAeq = [tempAeq ' = ' num2str(beq(ii))];
    sA{rowOfA,1}=tempAeq;
    n=0;
    tempAeq='';
    firstV=true;
end

set(handles.listboxObjective,'string',sF);
set(handles.editConstraints,'string',sA);

waitbar(1,h,'Finish');
pause(2);
delete(h);

set(handles.generateButton,'visible','on');
set(handles.calButton,'visible','off');
set(handles.exportButton,'visible','off');
set(handles.text13,'visible','off');
set(handles.editX,'visible','off');

guidata(hObject,handles);


function editX_Callback(hObject, eventdata, handles)
% hObject    handle to editX (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editX as text
%        str2double(get(hObject,'String')) returns contents of editX as a double

% --- Executes during object creation, after setting all properties.

function editX_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editX (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in generateButton.
function generateButton_Callback(hObject, eventdata, handles)
% hObject    handle to generateButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

h=waitbar(0, 'Please wait, generating the secret key now...');

tic;
global nF nA nAeq nbeq;
global M y r;
global cT AT bT AeqT beqT;

[nrowAeq, ncolAeq] = size(nAeq);
% generate random n x n non-singular matrix M
M = randi([1,50],ncolAeq);

% generate random n x 1 vector r
r = randi([1,50],ncolAeq,1);

% generate random integer between 1 and 100
y = round(rand(1)*99)+1;

cT = y * M' * nF;           % c' = yM'c
% cT = y * nF;

% create non-singular(invertible)(square) matrix (deteminant =/= 0)
% ------------------------------
% check Aeq has full row rank
if rank(nAeq)==nrowAeq
    fullRowRank=true;
end
%-------------------------------

% generate m x m non-singular matrix Q
% Q=rand(nrowAeq);
Q = randi([1,50],nrowAeq);

while det(Q)==0
    Q = randi([1,50],nrowAeq);
end

AeqT = Q * nAeq * M;                    % A' = QAM
beqT = Q * (nbeq + (nAeq * r));         % b' = Q(b + Ar)

% AeqT = Q * nAeq;                      % A' = QA
% beqT = Q * nbeq;                      % b' = Qb

L =randi([1,50],ncolAeq,nrowAeq);
AT = (nA * M) - (L * AeqT);         % B' = BM - LQAM => BM-LA' =>(A' = AeqT)
bT = (nA * r) - (L * beqT);         % 0' = Br - L(Q(b+Ar)) =>(Q(b+Ar) = beqT)
% AT = (nA - (L * nAeq));               % B' = (B - LA)
% bT = -1 * (L * nbeq);

% display transform Time
toc;

set(handles.transformTimeText, 'String', toc);

% disp f (objective)
n=0;
sF2='';
firstV=true;
cT2 = cT';
for ii=1:1:length(cT2)
    if (cT2(1,ii) == 0 )
        sF2 = sF2;
        n=n+1;
    else if (cT2(1,ii) > 0 )
            n=n+1;
            if firstV == true
                if (cT2(1,ii) == 1)
                    sF2 = [sF2 'x' num2str(n) '' ];
                else
                    sF2 = [sF2 num2str(cT2(1,ii)) 'x' num2str(n) '' ];
                end
                firstV=false;
            else
                if (cT2(1,ii) == 1)
                    sF2 = [sF2 ' + x' num2str(n) '' ];
                else
                    sF2 = [sF2 ' + ' num2str(cT2(1,ii)) 'x' num2str(n) '' ];
                end
            end
        else
            n=n+1;
            if firstV == true
                if (cT2(1,ii) == -1)
                    sF2 = [sF2 '- x' num2str(ii) '' ];
                else
                    sF2 = [sF2 num2str(cT2(1,ii)) 'x' num2str(ii) '' ];
                end
                firstV=false;
            else
                if (cT2(1,ii) == -1)
                    sF2 = [sF2 ' - x' num2str(n) '' ];
                else
                    sF2 = [sF2 ' - ' num2str(abs(cT2(1,ii))) 'x' num2str(n) '' ];
                end
            end
        end
    end
end

% display Ax = b (equality & inequality constraints)
n=0;
rowOfA=1;
tempA='';
firstV=true;
sA2=[];
[row col]=size(AeqT);
for ii=1:1:row
    for jj=1:1:col
        if (AeqT(ii,jj) == 0 )
            n=n+1;
            tempA = tempA;
        else if (AeqT(ii,jj) > 0 )
                n=n+1;
                if firstV == true
                    if (AeqT(ii,jj) == 1)
                        tempA = [tempA 'x' num2str(n) '' ];
                    else
                        tempA = [tempA num2str(AeqT(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (AeqT(ii,jj) == 1)
                        tempA = [tempA ' + x' num2str(n) '' ];
                    else
                        tempA = [tempA ' + ' num2str(AeqT(ii,jj)) 'x' num2str(n) '' ];
                    end
                end
            else
                n=n+1;
                if firstV == true
                    if (AeqT(ii,jj) == -1)
                        tempA = [tempA '- x' num2str(n) '' ];
                    else
                        tempA = [tempA num2str(AeqT(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (AeqT(ii,jj) == -1)
                        tempA = [tempA ' - x' num2str(n) '' ];
                    else
                        tempA = [tempA ' - ' num2str(abs(AeqT(ii,jj))) 'x' num2str(n) '' ];
                    end
                end
            end
        end
    end
    tempA = [tempA ' = ' num2str(beqT(ii)) ];
    sA2{rowOfA,1}=tempA;
    rowOfA = rowOfA + 1;
    n=0;
    tempA='';
    firstV=true;
end

% display Bx <= 0 (inequality constraints)
n=0;
tempA='';
firstV=true;
[row col]=size(AT);
for ii=1:1:row
    for jj=1:1:col
        if (AT(ii,jj) == 0 )
            n=n+1;
            tempA = tempA;
        else if (AT(ii,jj) > 0 )
                n=n+1;
                if firstV == true
                    if (AT(ii,jj) == 1)
                        tempA = [tempA 'x' num2str(n) '' ];
                    else
                        tempA = [tempA num2str(AT(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (AT(ii,jj) == 1)
                        tempA = [tempA ' + x' num2str(n) '' ];
                    else
                        tempA = [tempA ' + ' num2str(AT(ii,jj)) 'x' num2str(n) '' ];
                    end
                end
            else
                n=n+1;
                if firstV == true
                    if (AT(ii,jj) == -1)
                        tempA = [tempA ' - x' num2str(n) '' ];
                    else
                        tempA = [tempA num2str(AT(ii,jj)) 'x' num2str(n) '' ];
                    end
                    firstV=false;
                else
                    if (AT(ii,jj) == -1)
                        tempA = [tempA ' - x' num2str(n) '' ];
                    else
                        tempA = [tempA ' - ' num2str(abs(AT(ii,jj))) 'x' num2str(n) '' ];
                    end
                end
            end
        end
    end
    tempA = [tempA ' <= ' num2str(bT(ii)) ];
    sA2{rowOfA,1}=tempA;
    rowOfA = rowOfA + 1;
    n=0;
    tempA='';
    firstV=true;
end

set(handles.listboxObjective,'string',sF2);
set(handles.editConstraints,'string',sA2);

set(handles.generateButton,'visible','off');
set(handles.calButton,'visible','on');

waitbar(1,h,'Finish');
pause(2);
delete(h);


% --- Executes on button press in calButton.
function calButton_Callback(hObject, eventdata, handles)
% hObject    handle to calButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global cT AT bT AeqT beqT;
global f y fval exitflag sX;

% [x,fval,exitflag]=linprog(nF,nA,nb,nAeq,nbeq);
tic;
[y,fval,exitflag] = linprog(cT,AT,bT,AeqT,beqT);
% display calculate LP result
toc;

set(handles.calculateTimeText, 'String', num2str(toc));

% display x
if exitflag > 0             % Normal: x is an optimal solution
    sX=[];
    tempX='Normal: The LP problem has an optimal solution.';
    sX{1,1}=tempX;
    for ii=1:1:length(f)
        tempX = ['x' num2str(ii) ' = ' num2str(round(((y(ii))*100))/100)];
        sX{ii+1,1}=tempX;
    end
else if exitflag == 0       % Unbounded: Max. no. of iterations was reached
        sX{1,1} = 'Unbounded: Maximum number of iterations was reached.';
    else if exitflag < 0
            sX{1,1} = 'Infeasible: No solution.';
        end
    end
end

set(handles.editX,'string',sX);
set(handles.text13,'visible','on');
set(handles.editX,'visible','on');
set(handles.calButton,'visible','off');
set(handles.getButton,'visible','on');

% --- Executes on button press in getButton.
function getButton_Callback(hObject, eventdata, handles)
% hObject    handle to getButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global f M y r exitflag;
global sX sF sA;
x = round ((M * y) - r);

% display x
if exitflag > 0             % Normal: x is an optimal solution
    sX=[];
    tempX='Normal: The LP problem has an optimal solution.';
    sX{1,1}=tempX;
    for ii=1:1:length(f)
        tempX = ['x' num2str(ii) ' = ' num2str(round(((x(ii))*100))/100)];
        sX{ii+1,1}=tempX;
    end
else if exitflag == 0       % Unbounded: Max. no. of iterations was reached
        sX{1,1} = 'Unbounded: Maximum number of iterations was reached.';
    else if exitflag < 0
            sX{1,1} = 'Infeasible: No solution.';
        end
    end
end

set(handles.listboxObjective,'string',sF);
set(handles.editConstraints,'string',sA);

set(handles.editX,'string',sX);
set(handles.getButton,'visible','off');
set(handles.calButton,'visible','off');
set(handles.exportButton,'visible','on');


% --- Executes on button press in exportButton.
function exportButton_Callback(hObject, eventdata, handles)
% hObject    handle to exportButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global sX;
[filename, pathname]= uiputfile({'*.xls';'*.xlsx'}, 'Save file name', 'C:\Downloads\Data.xls');

str=[pathname, filename];

xlswrite(str, sX);



function editConstraints_Callback(hObject, eventdata, handles)
% hObject    handle to editConstraints (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editConstraints as text
%        str2double(get(hObject,'String')) returns contents of editConstraints as a double


% --- Executes during object creation, after setting all properties.
function editConstraints_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editConstraints (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in listboxObjective.
function listboxObjective_Callback(hObject, eventdata, handles)
% hObject    handle to listboxObjective (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listboxObjective contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listboxObjective


% --- Executes during object creation, after setting all properties.
function listboxObjective_CreateFcn(hObject, eventdata, handles)
% hObject    handle to listboxObjective (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
